// @ts-ignore
/* eslint-disable */
import {
  AreaTypesParams,
  AreaTypesResult,
  AreaTypesResultItem,
} from '@/services/api/model/areaTypesModel';
/* 站点相关 */
import { request } from '@umijs/max';
/** 获取站点 GET  */
export async function getAreasList(params: API.AreasParams, options?: { [key: string]: any }) {
  return request<API.AreaResult>(API_URL + '/superlink/api/areas', {
    method: 'GET',
    params,
    ...(options || {}),
  });
}
export async function getList(params?: AreaTypesParams, options?: { [key: string]: any }) {
  return request<AreaTypesResult>(API_URL + '/superlink/api/areas/v2/areas', {
    method: 'GET',
    params,
    ...(options || {}),
  });
}
export async function delItem(id: string) {
  return request(API_URL + '/superlink/api/areas/delete/' + id, {
    method: 'DELETE',
  });
}

export async function createItem(data: AreaTypesResultItem) {
  return request(API_URL + '/superlink/api/areas/create', {
    method: 'POST',
    data,
  });
}
export async function updateItem(data: AreaTypesResultItem) {
  return request(API_URL + '/superlink/api/areas/update/' + data.token, {
    method: 'PUT',
    data,
  });
}

export async function getItemDetails(
  params: { includeAsset?: boolean; token: string; includeContainedAreaTypes?: boolean },
  options?: { [key: string]: any },
) {
  return request<AreaTypesResultItem>(API_URL + '/superlink/api/areas/' + params.token, {
    method: 'GET',
    ...(options || {}),
  });
}
